home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks96 / FlyPaper.sit / Fly Paper / FlyPaper Source / App Sources / ST_ / ST_MacClasses.h < prev    next >
Text File  |  1996-06-22  |  2KB  |  92 lines

  1. #ifndef ST_MACCLASSES_H
  2. #define ST_MACCLASSES_H
  3.  
  4. #include "ST_.h"
  5. #include <MixedMode.h>
  6. #include <CodeFragments.h>
  7. #include <Quickdraw.h>
  8. #include <Resources.h>
  9. #include <AppleEvents.h>
  10. #include <Aliases.h>
  11. #include <Drag.h>
  12.  
  13. /* Drag Manager */
  14. DECLARE_ST_ (ST_DragReference, DragReference, DisposeDrag, 0)
  15.  
  16. /* Memory Manager */
  17. DECLARE_ST_ (ST_Ptr, Ptr, DisposePtr, nil)
  18. DECLARE_ST_ (ST_Handle, Handle, DisposeHandle, nil)
  19. DECLARE_ST_ (ST_ZoneSaver, THz, SetZone, nil)
  20.  
  21. /* Resource Manager */
  22. DECLARE_ST_ (ST_ResourceHandle, Handle, ReleaseResource, nil)
  23. DECLARE_ST_ (ST_ResFileSaver, short, UseResFile, -1)
  24. DECLARE_ST_ (ST_ResFileCloser, short, CloseResFile, -1)
  25.  
  26. /* QuickDraw */
  27. DECLARE_ST_ (ST_GrafPortSaver, GrafPtr, SetPort, nil)
  28. DECLARE_ST_ (ST_RgnHandle, RgnHandle, DisposeRgn, nil)
  29.  
  30. /* File Manager */
  31. DECLARE_ST_ (ST_FileCloser, short, FSClose, 0)
  32.  
  33. /* MixedMode Manager */
  34.  
  35. /* temporarily turn off ';' warning generated under 68K builds */
  36. #pragma warn_possunwant off
  37. DECLARE_ST_ (ST_RoutineDescriptor, UniversalProcPtr, DisposeRoutineDescriptor, nil)
  38. #pragma warn_possunwant reset
  39.  
  40.  
  41. /* Code fragment manager */
  42. DECLARE_STP_ (ST_ConnectionID, ConnectionID, CloseConnection, 0)
  43.  
  44. /* AppleEvent Manager */
  45. class ST_AEDesc {
  46.     private:
  47.         AEDesc    theAEDesc;
  48.         void operator = (const AEDesc &aAEDesc);
  49.     public:
  50.         ST_AEDesc (const AEDesc &aAEDesc) {theAEDesc = aAEDesc;}
  51.         ~ST_AEDesc () {if (theAEDesc.dataHandle) AEDisposeDesc (&theAEDesc);}
  52.         operator AEDesc& (void) {return theAEDesc;}
  53.         void Forget (void) {theAEDesc.dataHandle = nil;}
  54. };
  55.  
  56. /* Alias Manager */
  57. class ST_AliasHandle {                                                                                
  58.     private:
  59.         AliasHandle    theAlias;
  60.         void operator = (const AliasHandle &anAlias);
  61.     public:
  62.         ST_AliasHandle (const AliasHandle &anAlias) {theAlias = anAlias;}
  63.         ~ST_AliasHandle () {if (theAlias) DisposeHandle ((Handle)theAlias);}
  64.         operator AliasHandle& (void) {return theAlias;}
  65.         void Forget (void) {theAlias = nil;}
  66. };
  67.  
  68. /* More Memory Manager... */
  69.  
  70. class ST_HandleStateSaver {                                                                                
  71.     private:
  72.         Handle            theHandle;
  73.         SignedByte        theState;
  74.         void operator = (const Handle &aHandle);
  75.     public:
  76.         ST_HandleStateSaver (const Handle &aHandle) : theHandle (aHandle) {theState = HGetState (aHandle);}
  77.         ~ST_HandleStateSaver () {if (theHandle) RestoreState ();}
  78.         operator SignedByte& (void) {return theState;}
  79.         void Forget (void) {theHandle = nil;}
  80.         void RestoreState (void) {HSetState (theHandle, theState); }
  81. };
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91. #endif
  92.